#include "XMinusParseNode.h"


XMinusParseNode::XMinusParseNode()
{
    childs = new XAbstractParseNode *[2];
    childs[0] = nullptr;
    childs[1] = nullptr;
}

XMinusParseNode::~XMinusParseNode()
{
    delete childs[0];
    delete childs[1];
    delete childs;
}

const char *XMinusParseNode::getName() const
{
    return "-";
}

int XMinusParseNode::getCountArgs() const
{
    return 2;
}

void XMinusParseNode::updateValue()
{
    double a;
    childs[0]->updateValue();
    a = childs[0]->getValue();

    double b;
    childs[1]->updateValue();
    b = childs[1]->getValue();

    value = a - b;
}